package com.bicon.botu.mall.component.vo;

import com.bicon.botu.mall.component.entity.HomeFunctions;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Map;

/**
 * 首页服务定义VO
 *
 * @author 王开亮
 * @date 2018/2/26 14:19
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class HomeFunctionVo {

    /**
     * ID
     */
    private String id;

    /**
     * 服务名称
     */
    private String name;

    /**
     * 服务Code
     */
    private String code;

    /**
     * 图标URL
     */
    private String iconUrl;

    /**
     * 参数
     */
    private String params;

    /**
     * 状态
     */
    private Integer status;

    public HomeFunctionVo(HomeFunctions functions) {
        if(functions==null){
            return;
        }
        this.id = functions.getId();
        this.name = functions.getName();
        this.code = functions.getCode();
        this.iconUrl = functions.getIconUrl();
        this.params = functions.getParams();
        this.status = functions.getStatus();
    }

    public HomeFunctionVo(Map<String,String> map) {
        if(map==null){
            return;
        }
        this.id = map.get("id");
        this.name = map.get("name");
        this.code = map.get("code");
        this.iconUrl = map.get("iconUrl");
        this.params = map.get("params");
        this.status = Integer.valueOf(map.get("status"));
    }
}
